#!/bin/bash



readonly  BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"  ;  #项目地址


echo  "项目地址 ==>  "   $BASE_DIR


branch="dev"
year_month="202304"
year="2023"
month="04"
day="10"








cd    ${BASE_DIR}"/.data/eticket/$branch/$year_month/$day"
echo  "路径 ==>  $(pwd) "
trans_date=$year"_"$month"_"$day
echo    "trans_date is  $trans_date"
for   item  in    $(ls | grep "tar")     ;  do




  echo " 解析文件  $item "


  mkdir  -p  ${BASE_DIR}"/.data/eticket_download/$branch/$year_month/$day"

  tar   xf   $item   -C  ${BASE_DIR}"/.data/eticket_download/$branch/$year_month/$day"

  cd   ${BASE_DIR}"/.data/eticket_download/$branch/$year_month/$day"


  vsp_txt=$(basename $item  .tar  ).txt
  echo  "txt file is  $vsp_txt  "
  echo  $(pwd)
  cat   $vsp_txt

  echo  "write to file ...... "
  sed "s/^/${trans_date},&/g"   -i  $vsp_txt




done





















